<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Netbar extends MY_Controller {

	function Netbar()
	{
		parent::MY_Controller();
        $this->load->helper('page');
	}

	function area($id='',$offset=0){
		page_common();
		if (!$id) {
			$this->template->view('v1/netbar',array('error'=>1));exit();
		}
		$this->load->model('Mnetbar');
		$total = $this->Mnetbar->get_netbar_count($id);

		$this->load->library('pagination');

		$config['base_url'] = base_url().'netbar/area/'.$id.'/';
		$config['total_rows'] = $total;
		$config['per_page'] = 14;
		$config['uri_segment'] = 4;
		$config['num_links'] = 3;
		$config['full_tag_open'] = '<div class="pagebar">';
		$config['full_tag_close'] = '</div>';
		$config['cur_tag_open'] = '<span class="current">';
		$config['cur_tag_close'] = '</span>';
		$config['first_link'] = '&#171;';
		$config['last_link'] = '&#187;';
		$config['next_link'] = '&gt;';
		$config['prev_link'] = '&lt;';

		$this->pagination->initialize($config);

		$page_html = $this->pagination->create_links();

		//echo $page_html;exit;

		$limit = $config['per_page'];

		$info = $this->Mnetbar->get_area_info($id);
		$bars = $this->Mnetbar->get_netbar_by_area($id,$offset,$limit);
		$this->template->view('v1/netbar',array('bars'=>$bars,'info'=>$info,'page_html'=>$page_html));
	}

}

?>